<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="root">
    <p>{{ name }}</p>
  </div>
  <script src="../node_modules/vue/dist/vue.js"></script>
  <script>
    let app = new Vue({
      el: '#root',
      data: {
        name: 'jim',
        a: {
          b: {
            c: 'jim'
          }
        },
        obj: {
          name: '张三'
        }
      },
      watch: {
        // 
        'a.b.c': function (o, n) {
          console.log('>>>>', o, n);
        },
        // 'name': (o, n) => {
        //   console.log(o, n)
        // }，
        // 'obj.name'() {
        //   console.log('改变了')
        // },
        obj: {
          handler(val, oldval) {
            console.log('不管改变多深路径， 都能监听到改变数据了', val, oldval)
          },
          deep: true,
          immediate: true
        },

        name: {
          handler(o, n) {
            console.log('深度监听, 页面加载执行一次', o, n)
          },
          immediate: true
        }
      }
    });
  </script>
</body>

</html>